<?php
if(isset($role_by_group)){
    ?>
<ul class="nav">
        <?php if(array_key_exists("configuration", $role_by_group['code']) 
                || array_key_exists("adminlog", $role_by_group['code']) 
                || array_key_exists("telecom", $role_by_group['code']) 
                || array_key_exists("quickprint", $role_by_group['code']) 
                || array_key_exists("paymentlog", $role_by_group['code']) 
                || array_key_exists("quickPrintReceipt", $role_by_group['code'])):?>
            <li class="dropdown <?php if (in_array($this->uri->segment(2), array('configuration','adminlog','telecom','paymentlog'))) echo ' active'; ?>">
			<a href="#" class="dropdown-toggle" data-toggle="dropdown">
				<?php echo $this->lang->line('menu_system')?>
				<b class="caret"></b>
			</a>
			<ul class="dropdown-menu">
				<li>
					<?php if(array_key_exists("configuration", $role_by_group['code'])):?>
						<a href="<?php echo site_url("auth/configuration"); ?>"><?php echo $this->lang->line('configuration')?></a>
					<?php endif;?>
                                        <?php if(array_key_exists("adminlog", $role_by_group['code'])):?>
						<a href="<?php echo site_url("auth/adminlog"); ?>"><?php echo $this->lang->line('menu_adminlog')?></a>	
					<?php endif;?>
                                         <?php if(array_key_exists("telecom", $role_by_group['code'])):?>
						<a href="<?php echo site_url("auth/telecom"); ?>"><?php echo $this->lang->line('telecom')?></a>	
					<?php endif;?>
                                        <?php if(array_key_exists("quickprint", $role_by_group['code'])):?>
						<a href="<?php echo site_url("auth/others/quickprint"); ?>"><?php echo $this->lang->line('quickprint')?></a>
					<?php endif;?>
                                        <?php if(array_key_exists("quickPrintReceipt", $role_by_group['code'])):?>
						<a href="<?php echo site_url("auth/others/quickPrintReceipt"); ?>"><?php echo $this->lang->line('quickPrintReceipt')?></a>
					<?php endif;?>
                                        <?php if(array_key_exists("paymentlog", $role_by_group['code'])):?>
						<a href="<?php echo site_url("auth/paymentlog"); ?>"><?php echo $this->lang->line('paymentlog')?></a>
					<?php endif;?>
				</li>
			</ul>
		</li>
	<?php endif;?>
    
        <?php if(array_key_exists("user", $role_by_group['code']) || array_key_exists("group", $role_by_group) || array_key_exists("role", $role_by_group)):?>	
		<li class="dropdown <?php if (in_array($this->uri->segment(2), array( "user", "group", "role"))) echo 'active'; ?>">
			<a href="#" class="dropdown-toggle" data-toggle="dropdown">
				<?php echo $this->lang->line('menu_user')?>
				<b class="caret"></b>
			</a>
			<ul class="dropdown-menu">
				<li>
					<?php if(array_key_exists("user", $role_by_group['code'])):?>
						<a href="<?php echo site_url("auth/user"); ?>"><?php echo $this->lang->line('menu_user')?></a>
					<?php endif;?>
					<?php if(array_key_exists("group", $role_by_group['code'])):?>
						<a href="<?php echo site_url("auth/group"); ?>"><?php echo $this->lang->line('menu_group')?></a>
					<?php endif;?>
					<?php if(array_key_exists("role", $role_by_group['code'])):?>
						<a href="<?php echo site_url("auth/role"); ?>"><?php echo $this->lang->line('menu_role')?></a>	
					<?php endif;?>
				</li>
			</ul>
		</li>
	<?php endif;?>
   
        <?php if(array_key_exists("listcustomers", $role_by_group['code']) 
                || array_key_exists("listexport", $role_by_group['code']) 
                || array_key_exists("flyTomorrow", $role_by_group['code']) 
                || array_key_exists("customerAssess", $role_by_group['code']) 
                || array_key_exists("ticketWorkers", $role_by_group['code'])
                || array_key_exists("refundTicket", $role_by_group['code'])
                || array_key_exists("surplus", $role_by_group['code'])
                || array_key_exists("listcustomersDebts", $role_by_group['code'])
                || array_key_exists("voucher", $role_by_group['code'])
                || array_key_exists("voucherHistory", $role_by_group['code'])
                || array_key_exists("voucherArise", $role_by_group['code'])
                || array_key_exists("voucherLunisolar", $role_by_group['code'])
                || array_key_exists("sales", $role_by_group['code'])):?>	
                <li class="dropdown <?php if (in_array($this->uri->segment(2), array( "booking", "listexport", "flyTomorrow","customerAssess","ticketWorkers","bookingAdvance","refundTicket","surplus","voucher","listcustomersDebts","voucherHistory","voucherArise","voucherLunisolar"))) echo 'active'; ?>">
			<a href="#" class="dropdown-toggle" data-toggle="dropdown">
				<?php echo $this->lang->line('list')?>
				<b class="caret"></b>
			</a>
			<ul class="dropdown-menu">
				<li>
					<?php if(array_key_exists("listcustomers", $role_by_group['code'])):?>
						<a href="<?php echo site_url("auth/listcustomers"); ?>"><?php echo $this->lang->line('menu_listcustomers')?></a>
					<?php endif;?>
                                        <?php if(array_key_exists("listexport", $role_by_group['code'])):?>
						<a href="<?php echo site_url("auth/listexport"); ?>"><?php echo $this->lang->line('listexport')?></a>
					<?php endif;?>
                                        <?php if(array_key_exists("flyTomorrow", $role_by_group['code'])):?>
						<a href="<?php echo site_url("auth/flyTomorrow"); ?>"><?php echo $this->lang->line('flyTomorrow_list')?></a>
					<?php endif;?>
                                        <?php if(array_key_exists("customerAssess", $role_by_group['code'])):?>
						<a href="<?php echo site_url("auth/customerAssess"); ?>"><?php echo $this->lang->line('customerAssess_list')?></a>
					<?php endif;?>
                                        <?php if(array_key_exists("ticketWorkers", $role_by_group['code'])):?>
						<a href="<?php echo site_url("auth/ticketWorkers"); ?>"><?php echo $this->lang->line('ticketWorkers_list')?></a>
					<?php endif;?>
                                        <?php if(array_key_exists("sales", $role_by_group['code'])):?>
						<a href="<?php echo site_url("auth/sales"); ?>"><?php echo $this->lang->line('sales_list').' '.$this->lang->line('phone_callback')?></a>
					<?php endif;?>
                                        <?php if(array_key_exists("surplus", $role_by_group['code'])):?>
						<a href="<?php echo site_url("auth/surplus"); ?>"><?php echo $this->lang->line('surplus_list');?></a>
					<?php endif;?>
                                        <?php if(array_key_exists("listcustomersDebts", $role_by_group['code'])):?>
						<a href="<?php echo site_url("auth/listcustomersDebts"); ?>"><?php echo $this->lang->line('listcustomersDebts_list');?></a>
					<?php endif;?>
                                        <?php if(array_key_exists("voucher", $role_by_group['code'])):?>
						<a href="<?php echo site_url("auth/voucher"); ?>"><?php echo $this->lang->line('voucher_list');?></a>
					<?php endif;?>
                                        <?php if(array_key_exists("voucherHistory", $role_by_group['code'])):?>
						<a href="<?php echo site_url("auth/voucherHistory"); ?>"><?php echo $this->lang->line('voucherHistory_list');?></a>
					<?php endif;?>
                                        <?php if(array_key_exists("voucherArise", $role_by_group['code'])):?>
						<a href="<?php echo site_url("auth/voucherArise"); ?>"><?php echo $this->lang->line('voucherArise_list');?></a>
					<?php endif;?>
                                        <?php if(array_key_exists("voucherLunisolar", $role_by_group['code'])):?>
						<a href="<?php echo site_url("auth/voucherLunisolar"); ?>"><?php echo $this->lang->line('voucherLunisolar_list');?></a>
					<?php endif;?>
                                        <?php if(array_key_exists("refundTicket", $role_by_group['code'])):?>
						<a href="<?php echo site_url("auth/refundTicket"); ?>"><?php echo $this->lang->line('refundTicket_list')?></a>
					<?php endif;?>
				</li>
			</ul>
		</li>
	<?php endif;?>
                
        <?php if(array_key_exists("booking", $role_by_group['code']) 
                || array_key_exists("bookingStatus", $role_by_group['code']) 
                || array_key_exists("bookhistory", $role_by_group['code'])
                || array_key_exists("bookingAdvance", $role_by_group['code'])
                || array_key_exists("bookingDebts", $role_by_group['code'])
                || array_key_exists("bookYesterday", $role_by_group['code'])):?>	
                <li class="dropdown <?php if (in_array($this->uri->segment(2), array( "booking", "bookingStatus","bookhistory","bookingAdvance","bookYesterday","bookingDebts"))) echo 'active'; ?>">
			<a href="#" class="dropdown-toggle" data-toggle="dropdown">
				<?php echo $this->lang->line('booking')?>
				<b class="caret"></b>
			</a>
			<ul class="dropdown-menu">
				<li>
					<?php if(array_key_exists("booking", $role_by_group['code'])):?>
						<a href="<?php echo site_url("auth/booking"); ?>"><?php echo $this->lang->line('add').' '.$this->lang->line('booking')?></a>
					<?php endif;?>
                                        <?php if(array_key_exists("bookingStatus", $role_by_group['code'])):?>
						<a href="<?php echo site_url("auth/bookingStatus"); ?>"><?php echo $this->lang->line('unpaid')?></a>
					<?php endif;?>
                                        <?php if(array_key_exists("bookhistory", $role_by_group['code'])):?>
						<a href="<?php echo site_url("auth/bookhistory"); ?>"><?php echo $this->lang->line('paid')?></a>
					<?php endif;?>
                                        <?php if(array_key_exists("bookingAdvance", $role_by_group['code'])):?>
						<a href="<?php echo site_url("auth/bookingAdvance"); ?>"><?php echo $this->lang->line('bookingAdvance')?></a>
					<?php endif;?>
                                        <?php if(array_key_exists("bookYesterday", $role_by_group['code'])):?>
						<a href="<?php echo site_url("auth/bookYesterday"); ?>"><?php echo $this->lang->line('bookYesterday')?></a>
					<?php endif;?>
                                        <?php if(array_key_exists("bookingDebts", $role_by_group['code'])):?>
						<a href="<?php echo site_url("auth/bookingDebts"); ?>"><?php echo $this->lang->line('bookingDebts')?></a>
					<?php endif;?>
				</li>
			</ul>
		</li>
	<?php endif;?>
                
        <?php if(array_key_exists("paymentDebts", $role_by_group['code']) || array_key_exists("paymentBank", $role_by_group['code']) || array_key_exists("paymentOffice", $role_by_group['code']) || array_key_exists("paymentAtHome", $role_by_group['code']) || array_key_exists("paymentAir", $role_by_group['code'])):?>	
                <li class="dropdown <?php if (in_array($this->uri->segment(2), array( "paymentDebts", "paymentBank", "paymentOffice", "paymentAir"))) echo 'active'; ?>">
			<a href="#" class="dropdown-toggle" data-toggle="dropdown">
				<?php echo $this->lang->line('payment_manager')?>
				<b class="caret"></b>
			</a>
			<ul class="dropdown-menu">
				<li>
					<?php if(array_key_exists("paymentDebts", $role_by_group['code'])):?>
						<a href="<?php echo site_url("auth/paymentDebts"); ?>"><?php echo $this->lang->line('debts')?></a>
					<?php endif;?>
                                        <?php if(array_key_exists("paymentBank", $role_by_group['code'])):?>
						<a href="<?php echo site_url("auth/paymentBank"); ?>"><?php echo $this->lang->line('bank')?></a>
					<?php endif;?>
                                        <?php if(array_key_exists("paymentOffice", $role_by_group['code'])):?>
						<a href="<?php echo site_url("auth/paymentOffice"); ?>"><?php echo $this->lang->line('office')?></a>
					<?php endif;?>
                                        <?php if(array_key_exists("paymentAtHome", $role_by_group['code'])):?>
						<a href="<?php echo site_url("auth/paymentAtHome"); ?>"><?php echo $this->lang->line('home')?></a>
					<?php endif;?>
                                        <?php if(array_key_exists("paymentAir", $role_by_group['code'])):?>
						<a href="<?php echo site_url("auth/paymentAir"); ?>"><?php echo $this->lang->line('airline')?></a>
					<?php endif;?>
                                                
				</li>
			</ul>
		</li>
	<?php endif;?>
                
        <?php if(array_key_exists("sales", $role_by_group['code']) 
                || array_key_exists("getApiSales", $role_by_group['code'])
                || array_key_exists("listship", $role_by_group['code'])):?>
            <li class="dropdown <?php if (in_array($this->uri->segment(2), array('sales','listship','getApiSales'))) echo ' active'; ?>">
			<a href="#" class="dropdown-toggle" data-toggle="dropdown">
				<?php echo $this->lang->line('sales','listship','getApiSales')?>
				<b class="caret"></b>
			</a>
			<ul class="dropdown-menu">
				<li>
					<?php if(array_key_exists("sales", $role_by_group['code'])):?>
						<a href="<?php echo site_url("auth/sales/add"); ?>"><?php echo $this->lang->line('add').' '.$this->lang->line('sales')?></a>
					<?php endif;?>
                                       
                                        <?php if(array_key_exists("sales", $role_by_group['code'])):?>
						<a href="<?php echo site_url("auth/sales/statistic"); ?>"><?php echo $this->lang->line('statistic')?></a>
					<?php endif;?>
                                                
                                        <?php if(array_key_exists("listship", $role_by_group['code'])):?>
						<a href="<?php echo site_url("auth/listship"); ?>"><?php echo $this->lang->line('listship')?></a>
					<?php endif;?>
                                                
                                        <?php if(array_key_exists("getApiSales", $role_by_group['code'])):?>
						<a href="<?php echo site_url("auth/getApiSales"); ?>"><?php echo $this->lang->line('getApiSales_list')?></a>
					<?php endif;?>
				</li>
			</ul>
		</li>
	<?php endif;?>
                
        <?php if(array_key_exists("statiticsHr", $role_by_group['code']) 
                || array_key_exists("listBS", $role_by_group['code'])
                || array_key_exists("bookStatitics", $role_by_group['code'])):?>
            <li class="dropdown <?php if (in_array($this->uri->segment(2), array('statiticsHr','bookStatitics','listBS'))) echo ' active'; ?>">
			<a href="#" class="dropdown-toggle" data-toggle="dropdown">
				<?php echo $this->lang->line('statitics')?>
				<b class="caret"></b>
			</a>
			<ul class="dropdown-menu">
				<li>
					<?php if(array_key_exists("statiticsHr", $role_by_group['code'])):?>
						<a href="<?php echo site_url("auth/statiticsHr/lists"); ?>"><?php echo $this->lang->line('statiticsHr')?></a>
					<?php endif;?>
                                        <?php if(array_key_exists("bookStatitics", $role_by_group['code'])):?>
						<a href="<?php echo site_url("auth/bookStatitics/lists"); ?>"><?php echo $this->lang->line('bookStatitics')?></a>
					<?php endif;?>
                                        <?php if(array_key_exists("listBS", $role_by_group['code'])):?>
						<a href="<?php echo site_url("auth/listBS/lists"); ?>"><?php echo $this->lang->line('listBS')?></a>
					<?php endif;?>
				</li>
			</ul>
		</li>
	<?php endif;?>
        
        <?php if(array_key_exists("sales", $role_by_group['code']) 
                || array_key_exists("searchCustomers", $role_by_group['code'])
                || array_key_exists("searchBooking", $role_by_group['code'])):?>
            <li class="dropdown <?php if (in_array($this->uri->segment(2), array('sales','searchBooking','searchCustomers'))) echo ' active'; ?>">
			<a href="#" class="dropdown-toggle" data-toggle="dropdown">
				<?php echo $this->lang->line('menu_search')?>
				<b class="caret"></b>
			</a>
			<ul class="dropdown-menu">
				<li>
                                        <?php if(array_key_exists("searchBooking", $role_by_group['code'])):?>
						<a href="<?php echo site_url("auth/searchBooking"); ?>"><?php echo $this->lang->line('searchBooking')?></a>
					<?php endif;?>
                                        <?php if(array_key_exists("searchCustomers", $role_by_group['code'])):?>
						<a href="<?php echo site_url("auth/searchCustomers/"); ?>"><?php echo $this->lang->line('menu_searchCustomers')?></a>
					<?php endif;?>
                                        <?php if(array_key_exists("sales", $role_by_group['code'])):?>
						<a href="<?php echo site_url("auth/sales/search"); ?>"><?php echo $this->lang->line('sales_search')?></a>
					<?php endif;?>
				</li>
			</ul>
		</li>
	<?php endif;?>
                
        <?php if(array_key_exists("ketoan", $role_by_group['code'])):?>
            <li class="dropdown <?php if (in_array($this->uri->segment(2), array('ketoan'))) echo ' active'; ?>">
			<a href="#" class="dropdown-toggle" data-toggle="dropdown">
				<?php echo $this->lang->line('ketoan')?>
				<b class="caret"></b>
			</a>
			<ul class="dropdown-menu">
				<li>
                                        <?php if(array_key_exists("ketoan", $role_by_group['code'])):?>
						<a href="<?php echo site_url("auth/ketoan"); ?>"><?php echo $this->lang->line('export')?></a>
					<?php endif;?>
				</li>
			</ul>
		</li>
	<?php endif;?>
</ul>

<p class="navbar-text pull-right">
	<?php echo $this->lang->line('hello').', '. $username;?> 
	<a href="<?php echo site_url("auth/home/logout"); ?>">
		<?php echo $this->lang->line('menu_logout')?>
	</a>
</p>
<style>
    .pull-right{
        width:240px;
    }    
</style>
    <?php
}
?>